package com.xiashitech.interfaces.grpc;

import static io.grpc.MethodDescriptor.generateFullMethodName;

/**
 * <pre>
 * 服务接口.定义请求参数和相应结果
 * </pre>
 */
@javax.annotation.Generated(
    value = "by gRPC proto compiler (version 1.58.0)",
    comments = "Source: agent.proto")
@io.grpc.stub.annotations.GrpcGenerated
public final class RPCConfigServiceGrpc {

  private RPCConfigServiceGrpc() {}

  public static final java.lang.String SERVICE_NAME = "com.xiashitech.interfaces.grpc.RPCConfigService";

  // Static method descriptors that strictly reflect the proto.
  private static volatile io.grpc.MethodDescriptor<com.xiashitech.interfaces.grpc.RPCConfigRequest,
      com.xiashitech.interfaces.grpc.RPCConfigResponse> getGrpcSyncConfigMethod;

  @io.grpc.stub.annotations.RpcMethod(
      fullMethodName = SERVICE_NAME + '/' + "grpcSyncConfig",
      requestType = com.xiashitech.interfaces.grpc.RPCConfigRequest.class,
      responseType = com.xiashitech.interfaces.grpc.RPCConfigResponse.class,
      methodType = io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING)
  public static io.grpc.MethodDescriptor<com.xiashitech.interfaces.grpc.RPCConfigRequest,
      com.xiashitech.interfaces.grpc.RPCConfigResponse> getGrpcSyncConfigMethod() {
    io.grpc.MethodDescriptor<com.xiashitech.interfaces.grpc.RPCConfigRequest, com.xiashitech.interfaces.grpc.RPCConfigResponse> getGrpcSyncConfigMethod;
    if ((getGrpcSyncConfigMethod = RPCConfigServiceGrpc.getGrpcSyncConfigMethod) == null) {
      synchronized (RPCConfigServiceGrpc.class) {
        if ((getGrpcSyncConfigMethod = RPCConfigServiceGrpc.getGrpcSyncConfigMethod) == null) {
          RPCConfigServiceGrpc.getGrpcSyncConfigMethod = getGrpcSyncConfigMethod =
              io.grpc.MethodDescriptor.<com.xiashitech.interfaces.grpc.RPCConfigRequest, com.xiashitech.interfaces.grpc.RPCConfigResponse>newBuilder()
              .setType(io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING)
              .setFullMethodName(generateFullMethodName(SERVICE_NAME, "grpcSyncConfig"))
              .setSampledToLocalTracing(true)
              .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  com.xiashitech.interfaces.grpc.RPCConfigRequest.getDefaultInstance()))
              .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  com.xiashitech.interfaces.grpc.RPCConfigResponse.getDefaultInstance()))
              .setSchemaDescriptor(new RPCConfigServiceMethodDescriptorSupplier("grpcSyncConfig"))
              .build();
        }
      }
    }
    return getGrpcSyncConfigMethod;
  }

  private static volatile io.grpc.MethodDescriptor<com.xiashitech.interfaces.grpc.RPCSystemInfoRequest,
      com.xiashitech.interfaces.grpc.RPCSystemInfoResponse> getGrpcInitSystemInfoMethod;

  @io.grpc.stub.annotations.RpcMethod(
      fullMethodName = SERVICE_NAME + '/' + "grpcInitSystemInfo",
      requestType = com.xiashitech.interfaces.grpc.RPCSystemInfoRequest.class,
      responseType = com.xiashitech.interfaces.grpc.RPCSystemInfoResponse.class,
      methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
  public static io.grpc.MethodDescriptor<com.xiashitech.interfaces.grpc.RPCSystemInfoRequest,
      com.xiashitech.interfaces.grpc.RPCSystemInfoResponse> getGrpcInitSystemInfoMethod() {
    io.grpc.MethodDescriptor<com.xiashitech.interfaces.grpc.RPCSystemInfoRequest, com.xiashitech.interfaces.grpc.RPCSystemInfoResponse> getGrpcInitSystemInfoMethod;
    if ((getGrpcInitSystemInfoMethod = RPCConfigServiceGrpc.getGrpcInitSystemInfoMethod) == null) {
      synchronized (RPCConfigServiceGrpc.class) {
        if ((getGrpcInitSystemInfoMethod = RPCConfigServiceGrpc.getGrpcInitSystemInfoMethod) == null) {
          RPCConfigServiceGrpc.getGrpcInitSystemInfoMethod = getGrpcInitSystemInfoMethod =
              io.grpc.MethodDescriptor.<com.xiashitech.interfaces.grpc.RPCSystemInfoRequest, com.xiashitech.interfaces.grpc.RPCSystemInfoResponse>newBuilder()
              .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
              .setFullMethodName(generateFullMethodName(SERVICE_NAME, "grpcInitSystemInfo"))
              .setSampledToLocalTracing(true)
              .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  com.xiashitech.interfaces.grpc.RPCSystemInfoRequest.getDefaultInstance()))
              .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  com.xiashitech.interfaces.grpc.RPCSystemInfoResponse.getDefaultInstance()))
              .setSchemaDescriptor(new RPCConfigServiceMethodDescriptorSupplier("grpcInitSystemInfo"))
              .build();
        }
      }
    }
    return getGrpcInitSystemInfoMethod;
  }

  /**
   * Creates a new async stub that supports all call types for the service
   */
  public static RPCConfigServiceStub newStub(io.grpc.Channel channel) {
    io.grpc.stub.AbstractStub.StubFactory<RPCConfigServiceStub> factory =
      new io.grpc.stub.AbstractStub.StubFactory<RPCConfigServiceStub>() {
        @java.lang.Override
        public RPCConfigServiceStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
          return new RPCConfigServiceStub(channel, callOptions);
        }
      };
    return RPCConfigServiceStub.newStub(factory, channel);
  }

  /**
   * Creates a new blocking-style stub that supports unary and streaming output calls on the service
   */
  public static RPCConfigServiceBlockingStub newBlockingStub(
      io.grpc.Channel channel) {
    io.grpc.stub.AbstractStub.StubFactory<RPCConfigServiceBlockingStub> factory =
      new io.grpc.stub.AbstractStub.StubFactory<RPCConfigServiceBlockingStub>() {
        @java.lang.Override
        public RPCConfigServiceBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
          return new RPCConfigServiceBlockingStub(channel, callOptions);
        }
      };
    return RPCConfigServiceBlockingStub.newStub(factory, channel);
  }

  /**
   * Creates a new ListenableFuture-style stub that supports unary calls on the service
   */
  public static RPCConfigServiceFutureStub newFutureStub(
      io.grpc.Channel channel) {
    io.grpc.stub.AbstractStub.StubFactory<RPCConfigServiceFutureStub> factory =
      new io.grpc.stub.AbstractStub.StubFactory<RPCConfigServiceFutureStub>() {
        @java.lang.Override
        public RPCConfigServiceFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
          return new RPCConfigServiceFutureStub(channel, callOptions);
        }
      };
    return RPCConfigServiceFutureStub.newStub(factory, channel);
  }

  /**
   * <pre>
   * 服务接口.定义请求参数和相应结果
   * </pre>
   */
  public interface AsyncService {

    /**
     * <pre>
     * 服务端推送配置信息到 agent 端，响应用流
     * </pre>
     */
    default void grpcSyncConfig(com.xiashitech.interfaces.grpc.RPCConfigRequest request,
        io.grpc.stub.StreamObserver<com.xiashitech.interfaces.grpc.RPCConfigResponse> responseObserver) {
      io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGrpcSyncConfigMethod(), responseObserver);
    }

    /**
     * <pre>
     * agent 启动时初始化系统信息一次，无需流
     * </pre>
     */
    default void grpcInitSystemInfo(com.xiashitech.interfaces.grpc.RPCSystemInfoRequest request,
        io.grpc.stub.StreamObserver<com.xiashitech.interfaces.grpc.RPCSystemInfoResponse> responseObserver) {
      io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGrpcInitSystemInfoMethod(), responseObserver);
    }
  }

  /**
   * Base class for the server implementation of the service RPCConfigService.
   * <pre>
   * 服务接口.定义请求参数和相应结果
   * </pre>
   */
  public static abstract class RPCConfigServiceImplBase
      implements io.grpc.BindableService, AsyncService {

    @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
      return RPCConfigServiceGrpc.bindService(this);
    }
  }

  /**
   * A stub to allow clients to do asynchronous rpc calls to service RPCConfigService.
   * <pre>
   * 服务接口.定义请求参数和相应结果
   * </pre>
   */
  public static final class RPCConfigServiceStub
      extends io.grpc.stub.AbstractAsyncStub<RPCConfigServiceStub> {
    private RPCConfigServiceStub(
        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected RPCConfigServiceStub build(
        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
      return new RPCConfigServiceStub(channel, callOptions);
    }

    /**
     * <pre>
     * 服务端推送配置信息到 agent 端，响应用流
     * </pre>
     */
    public void grpcSyncConfig(com.xiashitech.interfaces.grpc.RPCConfigRequest request,
        io.grpc.stub.StreamObserver<com.xiashitech.interfaces.grpc.RPCConfigResponse> responseObserver) {
      io.grpc.stub.ClientCalls.asyncServerStreamingCall(
          getChannel().newCall(getGrpcSyncConfigMethod(), getCallOptions()), request, responseObserver);
    }

    /**
     * <pre>
     * agent 启动时初始化系统信息一次，无需流
     * </pre>
     */
    public void grpcInitSystemInfo(com.xiashitech.interfaces.grpc.RPCSystemInfoRequest request,
        io.grpc.stub.StreamObserver<com.xiashitech.interfaces.grpc.RPCSystemInfoResponse> responseObserver) {
      io.grpc.stub.ClientCalls.asyncUnaryCall(
          getChannel().newCall(getGrpcInitSystemInfoMethod(), getCallOptions()), request, responseObserver);
    }
  }

  /**
   * A stub to allow clients to do synchronous rpc calls to service RPCConfigService.
   * <pre>
   * 服务接口.定义请求参数和相应结果
   * </pre>
   */
  public static final class RPCConfigServiceBlockingStub
      extends io.grpc.stub.AbstractBlockingStub<RPCConfigServiceBlockingStub> {
    private RPCConfigServiceBlockingStub(
        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected RPCConfigServiceBlockingStub build(
        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
      return new RPCConfigServiceBlockingStub(channel, callOptions);
    }

    /**
     * <pre>
     * 服务端推送配置信息到 agent 端，响应用流
     * </pre>
     */
    public java.util.Iterator<com.xiashitech.interfaces.grpc.RPCConfigResponse> grpcSyncConfig(
        com.xiashitech.interfaces.grpc.RPCConfigRequest request) {
      return io.grpc.stub.ClientCalls.blockingServerStreamingCall(
          getChannel(), getGrpcSyncConfigMethod(), getCallOptions(), request);
    }

    /**
     * <pre>
     * agent 启动时初始化系统信息一次，无需流
     * </pre>
     */
    public com.xiashitech.interfaces.grpc.RPCSystemInfoResponse grpcInitSystemInfo(com.xiashitech.interfaces.grpc.RPCSystemInfoRequest request) {
      return io.grpc.stub.ClientCalls.blockingUnaryCall(
          getChannel(), getGrpcInitSystemInfoMethod(), getCallOptions(), request);
    }
  }

  /**
   * A stub to allow clients to do ListenableFuture-style rpc calls to service RPCConfigService.
   * <pre>
   * 服务接口.定义请求参数和相应结果
   * </pre>
   */
  public static final class RPCConfigServiceFutureStub
      extends io.grpc.stub.AbstractFutureStub<RPCConfigServiceFutureStub> {
    private RPCConfigServiceFutureStub(
        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected RPCConfigServiceFutureStub build(
        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
      return new RPCConfigServiceFutureStub(channel, callOptions);
    }

    /**
     * <pre>
     * agent 启动时初始化系统信息一次，无需流
     * </pre>
     */
    public com.google.common.util.concurrent.ListenableFuture<com.xiashitech.interfaces.grpc.RPCSystemInfoResponse> grpcInitSystemInfo(
        com.xiashitech.interfaces.grpc.RPCSystemInfoRequest request) {
      return io.grpc.stub.ClientCalls.futureUnaryCall(
          getChannel().newCall(getGrpcInitSystemInfoMethod(), getCallOptions()), request);
    }
  }

  private static final int METHODID_GRPC_SYNC_CONFIG = 0;
  private static final int METHODID_GRPC_INIT_SYSTEM_INFO = 1;

  private static final class MethodHandlers<Req, Resp> implements
      io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
    private final AsyncService serviceImpl;
    private final int methodId;

    MethodHandlers(AsyncService serviceImpl, int methodId) {
      this.serviceImpl = serviceImpl;
      this.methodId = methodId;
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("unchecked")
    public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
      switch (methodId) {
        case METHODID_GRPC_SYNC_CONFIG:
          serviceImpl.grpcSyncConfig((com.xiashitech.interfaces.grpc.RPCConfigRequest) request,
              (io.grpc.stub.StreamObserver<com.xiashitech.interfaces.grpc.RPCConfigResponse>) responseObserver);
          break;
        case METHODID_GRPC_INIT_SYSTEM_INFO:
          serviceImpl.grpcInitSystemInfo((com.xiashitech.interfaces.grpc.RPCSystemInfoRequest) request,
              (io.grpc.stub.StreamObserver<com.xiashitech.interfaces.grpc.RPCSystemInfoResponse>) responseObserver);
          break;
        default:
          throw new AssertionError();
      }
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("unchecked")
    public io.grpc.stub.StreamObserver<Req> invoke(
        io.grpc.stub.StreamObserver<Resp> responseObserver) {
      switch (methodId) {
        default:
          throw new AssertionError();
      }
    }
  }

  public static final io.grpc.ServerServiceDefinition bindService(AsyncService service) {
    return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
        .addMethod(
          getGrpcSyncConfigMethod(),
          io.grpc.stub.ServerCalls.asyncServerStreamingCall(
            new MethodHandlers<
              com.xiashitech.interfaces.grpc.RPCConfigRequest,
              com.xiashitech.interfaces.grpc.RPCConfigResponse>(
                service, METHODID_GRPC_SYNC_CONFIG)))
        .addMethod(
          getGrpcInitSystemInfoMethod(),
          io.grpc.stub.ServerCalls.asyncUnaryCall(
            new MethodHandlers<
              com.xiashitech.interfaces.grpc.RPCSystemInfoRequest,
              com.xiashitech.interfaces.grpc.RPCSystemInfoResponse>(
                service, METHODID_GRPC_INIT_SYSTEM_INFO)))
        .build();
  }

  private static abstract class RPCConfigServiceBaseDescriptorSupplier
      implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
    RPCConfigServiceBaseDescriptorSupplier() {}

    @java.lang.Override
    public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
      return com.xiashitech.interfaces.grpc.RPCAgentServiceApi.getDescriptor();
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
      return getFileDescriptor().findServiceByName("RPCConfigService");
    }
  }

  private static final class RPCConfigServiceFileDescriptorSupplier
      extends RPCConfigServiceBaseDescriptorSupplier {
    RPCConfigServiceFileDescriptorSupplier() {}
  }

  private static final class RPCConfigServiceMethodDescriptorSupplier
      extends RPCConfigServiceBaseDescriptorSupplier
      implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
    private final java.lang.String methodName;

    RPCConfigServiceMethodDescriptorSupplier(java.lang.String methodName) {
      this.methodName = methodName;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() {
      return getServiceDescriptor().findMethodByName(methodName);
    }
  }

  private static volatile io.grpc.ServiceDescriptor serviceDescriptor;

  public static io.grpc.ServiceDescriptor getServiceDescriptor() {
    io.grpc.ServiceDescriptor result = serviceDescriptor;
    if (result == null) {
      synchronized (RPCConfigServiceGrpc.class) {
        result = serviceDescriptor;
        if (result == null) {
          serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
              .setSchemaDescriptor(new RPCConfigServiceFileDescriptorSupplier())
              .addMethod(getGrpcSyncConfigMethod())
              .addMethod(getGrpcInitSystemInfoMethod())
              .build();
        }
      }
    }
    return result;
  }
}
